'use strict';

// key表
module.exports = app => {
  const { STRING, INTEGER, JSON, CHAR, DATE } = app.Sequelize;

  const Record = app.model.define('Record', {
    id: {
      type: INTEGER(4),
      allowNull: false,
      primaryKey: true,
      autoIncrement: true,
    },
    uuid: {
      type: CHAR(36),
      allowNull: true,
    },
    type: {
      type: STRING(30),
      allowNull: true,
    },
    status: {
      type: INTEGER(4).UNSIGNED,
      allowNull: true,
      defaultValue: '0',
    },
    name: {
      type: STRING(100),
      allowNull: true,
    },
    desc: {
      type: STRING(255),
      allowNull: true,
    },
    j_content: {
      type: JSON,
      allowNull: true,
    },
    valid: {
      type: INTEGER(1).UNSIGNED,
      allowNull: true,
      defaultValue: '1',
    },
    version: {
      type: INTEGER(4).UNSIGNED,
      allowNull: true,
      defaultValue: '1',
    },
    truth: {
      type: INTEGER(1).UNSIGNED,
      allowNull: true,
      defaultValue: '1',
    },
    is_show: {
      type: INTEGER(1).UNSIGNED,
      allowNull: true,
      defaultValue: '0',
    },
    publish_time: {
      type: DATE,
      allowNull: true,
    },
    publish_url: {
      type: STRING(2048),
      allowNull: true,
    },
    publish_name: {
      type: STRING(64),
      allowNull: true,
    },
    publish_desc: {
      type: STRING(512),
      allowNull: true,
    },
    licence: {
      type: STRING(255),
      allowNull: true,
    },
    licence_seat: {
      type: STRING(255),
      allowNull: true,
    },
    licence_time: {
      type: DATE,
      allowNull: true,
    },
    departure: {
      type: STRING(255),
      allowNull: true,
    },
    arrive: {
      type: STRING(255),
      allowNull: true,
    },
    carrier_desc: {
      type: STRING(255),
      allowNull: true,
    },
    province: {
      type: STRING(64),
      allowNull: true,
    },
    cities: {
      type: STRING(64),
      allowNull: true,
    },
    area: {
      type: STRING(64),
      allowNull: true,
    },
    address: {
      type: STRING(255),
      allowNull: true,
    },
    hash: {
      type: STRING(255),
      allowNull: true,
    },
  }, {
    tableName: 'record',
  });

  return Record;
};
